Skip to main content

Overview

These Python scripts demonstrate conversion from ISIS3 cubes to PDS4 format using GDAL’s PDS4 driver. They read ISIS3 label metadata and generate configuration files for gdal_translate, enabling automated conversions with proper PDS4 metadata.
PDS4 (Planetary Data System version 4) is NASA’s current standard for archiving planetary science data. These tools bridge ISIS3 and PDS4 workflows.

Available Scripts

isis3_to_pds4_LOLA_pvl.py

Uses the PVL library to parse ISIS3 labels.

isis3_to_pds4_LOLA_pysis.py

Uses the pysis library to read ISIS3 labels via ISIS commands.
Both scripts produce identical output but use different methods for reading ISIS3 metadata. Choose based on your environment and installed dependencies.

Installation

Requirements

For pvl version:
conda install -c conda-forge gdal
pip install pvl
For pysis version:
conda install -c conda-forge gdal
pip install pysis
GDAL 2.2.0 or later is required for PDS4 driver support. Use recent GDAL builds for best results.

Usage

isis3_to_pds4_LOLA_pvl.py

python isis3_to_pds4_LOLA_pvl.py input.cub output.config

Parameters

input.cub
string
required
Input ISIS3 cube file.
output.config
string
required
Output configuration file for gdal_translate.
-run
flag
Automatically execute gdal_translate after generating config.
-template
string
Path to custom PDS4 XML template. Defaults to $GDALDATA/pds4_template.xml.

Example Workflow

1

Generate Configuration

Create a config file from your ISIS3 cube:
python isis3_to_pds4_LOLA_pvl.py ldem_4.cub ldem_4.config
Output:
writing ldem_4.config
No ObservationId in ISIS3 Label
No FileName in ISIS3 Label

Recommended gdal run:
gdal_translate -of PDS4 -co IMAGE_FORMAT=GEOTIFF -co TEMPLATE=pds4_template.xml \
  --optfile ldem_4.config ldem_4.cub ldem_4_pds4.xml
2

Review Configuration

Examine the generated config file:
cat ldem_4.config
Example output:
#run as isis3_to_pds4_LOLA_pvl.py ldem_4.cub ldem_4.config
-co VAR_TARGET_TYPE=Satellite
-co VAR_INVESTIGATION_AREA_LID_REFERENCE="urn:nasa:pds:context:instrument_host:spacecraft.lro"
-co VAR_TARGET=MOON
-co VAR_INVESTIGATION_AREA_NAME="LUNAR RECONNAISSANCE ORBITER"
-co VAR_LOGICAL_IDENTIFIER=LRO-L-LOLA-4-GDR-V1.0
-co VAR_OBSERVING_SYSTEM_NAME=LOLA
-co VAR_TITLE=LDEM_4
3

Execute Conversion

Run the recommended gdal_translate command:
gdal_translate -of PDS4 -co IMAGE_FORMAT=GEOTIFF \
  -co TEMPLATE=pds4_template.xml \
  --optfile ldem_4.config \
  ldem_4.cub ldem_4_pds4.xml

Automated Conversion

Use the -run flag to execute conversion automatically:
python isis3_to_pds4_LOLA_pvl.py -run ldem_4.cub ldem_4.config

Custom Template

Provide a custom PDS4 XML template:
python isis3_to_pds4_LOLA_pvl.py -template my_template.xml input.cub output.config

PDS4 Template Variables

The scripts extract ISIS3 metadata and map it to PDS4 template variables:
VariableISIS3 SourceDescription
VAR_TARGETMapping/TargetNameTarget body name (e.g., MOON, MARS)
VAR_TARGET_TYPEHardcodedSet to “Satellite”
VAR_INVESTIGATION_AREA_NAMEArchive/InstrumentHostNameMission name (e.g., “LUNAR RECONNAISSANCE ORBITER”)
VAR_LOGICAL_IDENTIFIERArchive/DataSetIdDataset identifier (e.g., “LRO-L-LOLA-4-GDR-V1.0”)
VAR_OBSERVING_SYSTEM_NAMEArchive/InstrumentIdInstrument name (e.g., “LOLA”)
VAR_TITLEArchive/ProductIdProduct title
VAR_INVESTIGATION_AREA_LID_REFERENCEHardcodedContext URN for mission
Missing Metadata: If ISIS3 labels lack required fields, warnings are printed and those variables are omitted from the config file. You may need to manually add them.

PDS4 Format Details

What is PDS4?

PDS4 is the fourth major version of NASA’s Planetary Data System standard, featuring:
  • XML Labels: Structured, validated metadata in XML format
  • Multiple Data Formats: Supports FITS, GeoTIFF, raw binary, and more
  • Context Products: Links to missions, instruments, targets, and investigators
  • Schema Validation: Ensures compliance with PDS4 standards

GDAL PDS4 Driver

The GDAL PDS4 driver supports:
  • Reading and writing PDS4 products
  • GeoTIFF-embedded image data (IMAGE_FORMAT=GEOTIFF)
  • Custom XML templates with variable substitution
  • Spatial reference system preservation
For complete GDAL PDS4 driver documentation, see: http://www.gdal.org/frmt_pds4.html

Test Data

Example test data included in the repository:
~/workspace/source/PDS4gdal/test/ldem_4.cub
~/workspace/source/PDS4gdal/test/ldem_4_original_pds3.lbl
Data Source: LOLA 4 ppd DEM converted to ISIS3 from PDS: http://pds-geosciences.wustl.edu/missions/lro/lola.htm

Configuration File Format

The generated .config files contain gdal_translate options:
# Comment line with generation command
-co VAR_NAME=VALUE
-co VAR_NAME="VALUE WITH SPACES"
Use with gdal_translate --optfile config.txt to avoid lengthy command lines.

Customization

Modifying Extracted Metadata

Edit the Python scripts to extract additional ISIS3 metadata:
# Example: Add custom field
try:
    customField = isis3lbl['IsisCube']['MyGroup']['MyKeyword']
    theLine = '-co VAR_CUSTOM={}'.format(customField)
    fileConfig.write(theLine)
except KeyError:
    print('No MyKeyword in ISIS3 Label')

Custom PDS4 Templates

Create custom XML templates with placeholder variables:
<Mission_Area>
  <mission_name>${VAR_INVESTIGATION_AREA_NAME}</mission_name>
  <spacecraft_name>${VAR_SPACECRAFT_NAME}</spacecraft_name>
</Mission_Area>
The GDAL driver replaces ${VAR_*} with values from -co options.

Script Locations

~/workspace/source/PDS4gdal/isis3_to_pds4_LOLA_pvl.py
~/workspace/source/PDS4gdal/isis3_to_pds4_LOLA_pysis.py
~/workspace/source/PDS4gdal/pds4_template.xml

Troubleshooting

GDAL Version Issues

python -c "import gdal; print(gdal.__version__)"
Ensure GDAL >= 2.2.0 for PDS4 support.

Missing ISIS3 Metadata

If required fields are missing from ISIS3 labels, edit the config file manually:
-co VAR_LOGICAL_IDENTIFIER=YOUR-DATASET-ID

Template Not Found

Set GDAL_DATA environment variable:
export GDAL_DATA=/path/to/gdal/data
Or specify template explicitly:
-template /full/path/to/pds4_template.xml
These scripts serve as examples. Adapt them for your specific mission data and PDS4 requirements.